package list_;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * @author wly
 * @version V1.0.0
 * @date 2022/12/30 21:25
 */
public class ListExercise01 {
    public static void main(String[] args) {
        List list = new ArrayList();
        for (int i = 0; i < 12; i++) {
            list.add("hello" + i);
        }
        System.out.println("list=" + list);
        list.add(2, "wly");
        System.out.println("list=" + list);

        Object o = list.get(5);
        System.out.println("list[5] = " + o);

        list.remove(6);
        list.set(7, "8023");

        Iterator iterator = list.iterator();
        while (iterator.hasNext()) {
            Object next =  iterator.next();
            System.out.print(next + " ");
        }
    }
}
